package turring;

import java.util.ArrayList;

public class Etat {

	/** Symbole pour epsilon. */
	public static final char EPS = 0;
	private ArrayList<Transition> mesTransitions = new ArrayList<Transition>();
	private boolean terminal;

	public Etat() {
		terminal = false;
	}

	public ArrayList<Transition> getTransitions(char c) {
		ArrayList<Transition> retour = new ArrayList<Transition>();

		for (int i = 0; i < mesTransitions.size(); i++) {
			if (mesTransitions.get(i).transitionPossible(c)) {
				retour.add(mesTransitions.get(i));
			}
		}
		return retour;
	}

	public boolean estTerminal() {
		return terminal;
	}

	public void addTransition(Etat etat, char c, char d, int i) {
		mesTransitions.add(new Transition(c, d, etat, i));
	}

	public void setToTerminal() {
		terminal = true;
	}
}
